home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PASCAL
/
0188.ZIP
/
ITERM.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1986-01-26
|
7KB
|
208 lines
program iterm;
{
Scott Murphy
77 So. Adams St. #301
Denver, CO 80209
Compuserve 70156,263
}
Const
VERSION = '1.5';
SAVE_BUF_SIZE = 2048; {size of text save buffer}
BELL_FREQ = 440; {frequncy for bell sound}
BELL_DELAY = 100; {duration of bell sound}
DEFAULT_BAUD = 300; {Serial port speed at start-up}
type
bigstring = string[80]; {general purpose}
cset = set of 0..127;
var
SaveText : 0..1; {flag for saving text to disk}
SaveOpen : boolean; {flag for open textsave file}
SaveBuffer : array[1..SAVE_BUF_SIZE] of char;
SavePtr : integer;
SaveFile : file of char;
DiscardSet : set of 0..127;
exit,
xtnd : boolean;
a : byte;
c,i : integer;
PrevLine : string[40];
CurrLine : string[40];
LineIndex : integer;
ch : char;
{$C-}
{$I ITRMPORT.INC}
{$I ITRMMISC.INC}
{$I ITRMWIND.INC}
{$I ITRMXFER.INC}
{$I ITRMDIAL.INC}
{$I ITRMSAVE.INC}
begin
ClrScr;
InitWindow(StatWin,1,1,80,2);
InitWindow(TermWin,1,3,80,25);
CurrentWin := TermWin;
UsePermWindow(TermWin);
status(1,'ITERM ver: ' + VERSION);
status(2,'Initializing');
CurrLine := '';
PrevLine := '';
LineIndex := 1;
SaveText := 0;
SaveOpen := FALSE;
SavePtr := 1;
DiscardSet := [];
InitPhn;
setup;
set_up_recv_buffer;
remove_port;
setup;
set_up_recv_buffer;
exit := false;
GotoXY(1,1);
status(2,'Off-Line/Ready');
while not exit do
begin
if keypressed then
begin
scan(xtnd, a);
if xtnd then
case a of
19 : {alt-R}
recv_wcp;
45 : {alt-X}
begin
OpenTemp(20,18,60,22,1);
writeln('───ITERM───');
write('Do you really want to exit (Y/N)? ');
readln(ch);
if upcase(ch) = 'Y' then
exit := TRUE;
CloseTemp
end;
67 : {F9}
begin
SaveText := 1 - SaveText;
if SaveText = 1 then
begin
Status(3, 'Text save: ON');
if not SaveOpen then
InitSaveFile
end
else
Status(3, 'Text Save: OFF')
end;
68 : {F10}
if SaveOpen then
begin
SaveOpen := FALSE;
SaveText := 0;
status(3,'Closing save file');
for i := 1 to SavePtr do
write(SaveFile, SaveBuffer[i]);
close(SaveFile);
Status(3, 'Text Save: OFF')
end;
31 : {alt-S}
send_wcp;
32 : {alt-D}
auto_dial;
35 : {alt-H}
begin
writeln('───ITERM───');
status(2,'Disconnecting');
term_ready(FALSE);
delay(500);
term_ready(TRUE);
status(2,'Off-Line/Ready')
end;
46 : {alt-C}
ClrScr;
48 : {alt-B}
break;
25 : {alt-P}
NewParms;
59 : {F1}
if phones[CurPhone].paced then
SendPaced(phones[CurPhone].id + #13)
else
StrSend(phones[CurPhone].id + #13);
60 : {F2}
if phones[CurPhone].paced then
SendPaced(phones[CurPhone].pw + #13)
else
StrSend(phones[CurPhone].pw + #13);
61 : {F3}
SendPaced(PrevLine);
77 : {Cursor Right}
begin
if LineIndex <= length(PrevLine) then
send(ord(PrevLine[LineIndex]));
LineIndex := LineIndex + 1
end;
72 : {Cursor up}
PushPage;
80 : {Cursor Down}
PopPage;
65 : {F7}
SendAscii;
end {case}
else if a = 13 then
begin
PrevLine := CurrLine;
Currline := '';
LineIndex := 1;
send(a)
end
else
begin
CurrLine := CurrLine + chr(a);
send(a)
end
end; {if KeyPressed}
c := cgetc(0);
if not (c in DiscardSet) then
case c of
-1 : begin
end; {no action}
9 : {tab}
begin
for c := WhereX to (WhereX div 8 + 1)*8 do
write(' ');
c := 9
end;
7 : {bell}
begin
sound(BELL_FREQ);
delay(BELL_DELAY);
NoSound
end;
12 : {form-feed}
ClrScr;
else write(chr(c and $7F));
end; {case}
if (c <> -1) and (SaveText = 1) and (not (c in DiscardSet)) then
DiskBuffer(chr(c));
end; {while not exit}
remove_port;
if cflag then
begin
status(3,'Updating ITERM.PHN');
rewrite(phfile);
for c := 1 to MAXPHONES do
write(phfile, phones[c]);
close(phfile)
end;
if SaveOpen then
begin
status(3,'Closing save file');
for i := 1 to SavePtr do
write(SaveFile, SaveBuffer[i]);
close(SaveFile)
end;
ClrScr;
end.